package transcation;

import message.QLender;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.jms.*;

/**
 * Created with Intel IDEA.
 *
 * @Auther: gjt
 * @Date: 2024/11/16 10:53
 */
public class LenderBean {

    @Resource
    TopicConnectionFactory factory;

    @Resource
    Topic topic;

    TopicConnection connection = null;
    TopicSession session = null;
    TopicPublisher publisher = null;

    @PostConstruct
    public void init(){
        try {
            connection = factory.createTopicConnection();
            connection.start();

            session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
            publisher = session.createPublisher(topic);
        } catch (JMSException e) {
            throw new RuntimeException(e);
        }
    }

}
